package com.yupi.maker.generator;

import freemarker.template.TemplateException;

import java.io.File;
import java.io.IOException;

/**
 * @version 1.0
 * @Author moresuo
 * @Date 2024/9/8 17:56
 * @注释 动静结合
 */
public class MainGenerator {
    public static void main(String[] args) throws TemplateException, IOException {

    }

    public static void doGenerate(Object model) throws IOException, TemplateException {
        String inputRootPath = "D:\\code\\yuzi-generator\\yuzi-generator-demo-projects\\acm-template-pro";
        String outputRootPath="D:\\code\\yuzi-generator\\acm-template-pro";

        String inputPath;
        String outputPath;

        inputPath=new File(inputRootPath,"src/com/yupi/acm/MainTemplate.java.ftl").getAbsolutePath();
        outputPath=new File(outputRootPath,"src/com/yupi/acm/MainTemplate.java").getAbsolutePath();
        DynamicGenerator.doGenerate(inputPath,outputPath,model);

        inputPath = new File(inputRootPath, ".gitignore").getAbsolutePath();
        outputPath = new File(outputRootPath, ".gitignore").getAbsolutePath();
        StaticGenerator.copyFileByHutool(inputPath, outputPath);

        inputPath = new File(inputRootPath, "README.md").getAbsolutePath();
        outputPath = new File(outputRootPath, "README.md").getAbsolutePath();
        StaticGenerator.copyFileByHutool(inputPath, outputPath);

    }
}
